package ch.netcetera.planningpoker.client.ui.events;

import com.google.gwt.appengine.channel.client.Channel;
import com.google.gwt.appengine.channel.client.ChannelFactory;
import com.google.gwt.appengine.channel.client.ChannelFactory.ChannelCreatedCallback;
import com.google.web.bindery.event.shared.EventBus;

public class ChannelEventHelper {

    public static void registerChannelEventListener(final EventBus eventbus,
            String token) {
        ChannelFactory.createChannel(token, new ChannelCreatedCallback() {
            @Override
            public void onChannelCreated(Channel channel) {
                channel.open(new EventSocketListener(eventbus));
            }
        });
    }

}
